Optimal. Leaf size=171 \[ \frac {1}{8} \left (8 a^3 A+12 a A b^2+12 a^2 b B+3 b^3 B\right ) x+\frac {\left (16 a^2 A b+4 A b^3+3 a^3 B+12 a b^2 B\right ) \sin (c+d x)}{6 d}+\frac {b \left (20 a A b+6 a^2 B+9 b^2 B\right ) \cos (c+d x) \sin (c+d x)}{24 d}+\frac {(4 A b+3 a B) (a+b \cos (c+d x))^2 \sin (c+d x)}{12 d}+\frac {B (a+b \cos (c+d x))^3 \sin (c+d x)}{4 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.13, antiderivative size = 171, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 2, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.087, Rules used = {2832, 2813}
\begin {gather*} \frac {b \left (6 a^2 B+20 a A b+9 b^2 B\right ) \sin (c+d x) \cos (c+d x)}{24 d}+\frac {\left (3 a^3 B+16 a^2 A b+12 a b^2 B+4 A b^3\right ) \sin (c+d x)}{6 d}+\frac {1}{8} x \left (8 a^3 A+12 a^2 b B+12 a A b^2+3 b^3 B\right )+\frac {(3 a B+4 A b) \sin (c+d x) (a+b \cos (c+d x))^2}{12 d}+\frac {B \sin (c+d x) (a+b \cos (c+d x))^3}{4 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2813
Rule 2832
Rubi steps
\begin {align*} \int (a+b \cos (c+d x))^3 (A+B \cos (c+d x)) \, dx &=\frac {B (a+b \cos (c+d x))^3 \sin (c+d x)}{4 d}+\frac {1}{4} \int (a+b \cos (c+d x))^2 (4 a A+3 b B+(4 A b+3 a B) \cos (c+d x)) \, dx\\ &=\frac {(4 A b+3 a B) (a+b \cos (c+d x))^2 \sin (c+d x)}{12 d}+\frac {B (a+b \cos (c+d x))^3 \sin (c+d x)}{4 d}+\frac {1}{12} \int (a+b \cos (c+d x)) \left (12 a^2 A+8 A b^2+15 a b B+\left (20 a A b+6 a^2 B+9 b^2 B\right ) \cos (c+d x)\right ) \, dx\\ &=\frac {1}{8} \left (8 a^3 A+12 a A b^2+12 a^2 b B+3 b^3 B\right ) x+\frac {\left (16 a^2 A b+4 A b^3+3 a^3 B+12 a b^2 B\right ) \sin (c+d x)}{6 d}+\frac {b \left (20 a A b+6 a^2 B+9 b^2 B\right ) \cos (c+d x) \sin (c+d x)}{24 d}+\frac {(4 A b+3 a B) (a+b \cos (c+d x))^2 \sin (c+d x)}{12 d}+\frac {B (a+b \cos (c+d x))^3 \sin (c+d x)}{4 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.45, size = 140, normalized size = 0.82 \begin {gather*} \frac {12 \left (8 a^3 A+12 a A b^2+12 a^2 b B+3 b^3 B\right ) (c+d x)+24 \left (12 a^2 A b+3 A b^3+4 a^3 B+9 a b^2 B\right ) \sin (c+d x)+24 b \left (3 a A b+3 a^2 B+b^2 B\right ) \sin (2 (c+d x))+8 b^2 (A b+3 a B) \sin (3 (c+d x))+3 b^3 B \sin (4 (c+d x))}{96 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.13, size = 180, normalized size = 1.05
method | result | size |
derivativedivides | \(\frac {b^{3} B \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+\frac {A \,b^{3} \left (\cos ^{2}\left (d x +c \right )+2\right ) \sin \left (d x +c \right )}{3}+B a \,b^{2} \left (\cos ^{2}\left (d x +c \right )+2\right ) \sin \left (d x +c \right )+3 A a \,b^{2} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+3 a^{2} b B \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+3 A \,a^{2} b \sin \left (d x +c \right )+a^{3} B \sin \left (d x +c \right )+A \,a^{3} \left (d x +c \right )}{d}\) | \(180\) |
default | \(\frac {b^{3} B \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+\frac {A \,b^{3} \left (\cos ^{2}\left (d x +c \right )+2\right ) \sin \left (d x +c \right )}{3}+B a \,b^{2} \left (\cos ^{2}\left (d x +c \right )+2\right ) \sin \left (d x +c \right )+3 A a \,b^{2} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+3 a^{2} b B \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+3 A \,a^{2} b \sin \left (d x +c \right )+a^{3} B \sin \left (d x +c \right )+A \,a^{3} \left (d x +c \right )}{d}\) | \(180\) |
risch | \(a^{3} x A +\frac {3 x A a \,b^{2}}{2}+\frac {3 x \,a^{2} b B}{2}+\frac {3 b^{3} B x}{8}+\frac {3 \sin \left (d x +c \right ) A \,a^{2} b}{d}+\frac {3 \sin \left (d x +c \right ) A \,b^{3}}{4 d}+\frac {a^{3} B \sin \left (d x +c \right )}{d}+\frac {9 \sin \left (d x +c \right ) B a \,b^{2}}{4 d}+\frac {\sin \left (4 d x +4 c \right ) b^{3} B}{32 d}+\frac {\sin \left (3 d x +3 c \right ) A \,b^{3}}{12 d}+\frac {\sin \left (3 d x +3 c \right ) B a \,b^{2}}{4 d}+\frac {3 \sin \left (2 d x +2 c \right ) A a \,b^{2}}{4 d}+\frac {3 \sin \left (2 d x +2 c \right ) a^{2} b B}{4 d}+\frac {\sin \left (2 d x +2 c \right ) b^{3} B}{4 d}\) | \(203\) |
norman | \(\frac {\left (A \,a^{3}+\frac {3}{2} A a \,b^{2}+\frac {3}{2} a^{2} b B +\frac {3}{8} b^{3} B \right ) x +\left (A \,a^{3}+\frac {3}{2} A a \,b^{2}+\frac {3}{2} a^{2} b B +\frac {3}{8} b^{3} B \right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (4 A \,a^{3}+6 A a \,b^{2}+6 a^{2} b B +\frac {3}{2} b^{3} B \right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (4 A \,a^{3}+6 A a \,b^{2}+6 a^{2} b B +\frac {3}{2} b^{3} B \right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (6 A \,a^{3}+9 A a \,b^{2}+9 a^{2} b B +\frac {9}{4} b^{3} B \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {\left (24 A \,a^{2} b -12 A a \,b^{2}+8 A \,b^{3}+8 a^{3} B -12 a^{2} b B +24 B a \,b^{2}-5 b^{3} B \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}+\frac {\left (24 A \,a^{2} b +12 A a \,b^{2}+8 A \,b^{3}+8 a^{3} B +12 a^{2} b B +24 B a \,b^{2}+5 b^{3} B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d}+\frac {\left (216 A \,a^{2} b -36 A a \,b^{2}+40 A \,b^{3}+72 a^{3} B -36 a^{2} b B +120 B a \,b^{2}+9 b^{3} B \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}+\frac {\left (216 A \,a^{2} b +36 A a \,b^{2}+40 A \,b^{3}+72 a^{3} B +36 a^{2} b B +120 B a \,b^{2}-9 b^{3} B \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4}}\) | \(455\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 171, normalized size = 1.00 \begin {gather*} \frac {96 \, {\left (d x + c\right )} A a^{3} + 72 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} B a^{2} b + 72 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A a b^{2} - 96 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} B a b^{2} - 32 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} A b^{3} + 3 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} B b^{3} + 96 \, B a^{3} \sin \left (d x + c\right ) + 288 \, A a^{2} b \sin \left (d x + c\right )}{96 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.35, size = 136, normalized size = 0.80 \begin {gather*} \frac {3 \, {\left (8 \, A a^{3} + 12 \, B a^{2} b + 12 \, A a b^{2} + 3 \, B b^{3}\right )} d x + {\left (6 \, B b^{3} \cos \left (d x + c\right )^{3} + 24 \, B a^{3} + 72 \, A a^{2} b + 48 \, B a b^{2} + 16 \, A b^{3} + 8 \, {\left (3 \, B a b^{2} + A b^{3}\right )} \cos \left (d x + c\right )^{2} + 9 \, {\left (4 \, B a^{2} b + 4 \, A a b^{2} + B b^{3}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{24 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 386 vs.
\(2 (170) = 340\).
time = 0.23, size = 386, normalized size = 2.26 \begin {gather*} \begin {cases} A a^{3} x + \frac {3 A a^{2} b \sin {\left (c + d x \right )}}{d} + \frac {3 A a b^{2} x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {3 A a b^{2} x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {3 A a b^{2} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {2 A b^{3} \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {A b^{3} \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {B a^{3} \sin {\left (c + d x \right )}}{d} + \frac {3 B a^{2} b x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {3 B a^{2} b x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {3 B a^{2} b \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {2 B a b^{2} \sin ^{3}{\left (c + d x \right )}}{d} + \frac {3 B a b^{2} \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {3 B b^{3} x \sin ^{4}{\left (c + d x \right )}}{8} + \frac {3 B b^{3} x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} + \frac {3 B b^{3} x \cos ^{4}{\left (c + d x \right )}}{8} + \frac {3 B b^{3} \sin ^{3}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{8 d} + \frac {5 B b^{3} \sin {\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{8 d} & \text {for}\: d \neq 0 \\x \left (A + B \cos {\left (c \right )}\right ) \left (a + b \cos {\left (c \right )}\right )^{3} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.46, size = 148, normalized size = 0.87 \begin {gather*} \frac {B b^{3} \sin \left (4 \, d x + 4 \, c\right )}{32 \, d} + \frac {1}{8} \, {\left (8 \, A a^{3} + 12 \, B a^{2} b + 12 \, A a b^{2} + 3 \, B b^{3}\right )} x + \frac {{\left (3 \, B a b^{2} + A b^{3}\right )} \sin \left (3 \, d x + 3 \, c\right )}{12 \, d} + \frac {{\left (3 \, B a^{2} b + 3 \, A a b^{2} + B b^{3}\right )} \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} + \frac {{\left (4 \, B a^{3} + 12 \, A a^{2} b + 9 \, B a b^{2} + 3 \, A b^{3}\right )} \sin \left (d x + c\right )}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.57, size = 202, normalized size = 1.18 \begin {gather*} A\,a^3\,x+\frac {3\,B\,b^3\,x}{8}+\frac {3\,A\,a\,b^2\,x}{2}+\frac {3\,B\,a^2\,b\,x}{2}+\frac {3\,A\,b^3\,\sin \left (c+d\,x\right )}{4\,d}+\frac {B\,a^3\,\sin \left (c+d\,x\right )}{d}+\frac {A\,b^3\,\sin \left (3\,c+3\,d\,x\right )}{12\,d}+\frac {B\,b^3\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {B\,b^3\,\sin \left (4\,c+4\,d\,x\right )}{32\,d}+\frac {3\,A\,a\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {3\,B\,a^2\,b\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {B\,a\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{4\,d}+\frac {3\,A\,a^2\,b\,\sin \left (c+d\,x\right )}{d}+\frac {9\,B\,a\,b^2\,\sin \left (c+d\,x\right )}{4\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________